//import cz.muni.fi.pa165.machineryrental.entities.Rental;
//import cz.muni.fi.pa165.machineryrental.entities.Customer;
//import cz.muni.fi.pa165.machineryrental.entities.Machine;
//import cz.muni.fi.pa165.machineryrental.entities.User;
//import java.util.Date;

package cz.muni.fi.pa165.machineryrental.dao;

import cz.muni.fi.pa165.machineryrental.entities.Customer;
import cz.muni.fi.pa165.machineryrental.entities.Machine;
import cz.muni.fi.pa165.machineryrental.entities.Rental;
import java.util.Date;
import java.util.List;



/**
 * DAO for Rental entity with base CRUD methods and some 
 * specific methods for rentals.
 * 
 * @author Jozef Triscik
 */
public interface RentalDAO {
	
	/**
	 * Reads entity with given identifier from database.
	 * 
	 * @param id Represents unique identifier of rental instance.
	 * @return Rental, which has given identifier.
	 * @throws IllegalArgumentException Throws if given identifier is null.
	 * @throws IllegalStateException Throws if manager is not initialized.
	 */
    Rental getById(long id);
	
	/**
	 * Persists giver rental instance to database.
	 * 
	 * @param rental Represents rental to persist to database.
	 * @throws IllegalArgumentException Throws if given rental is null.
	 * @throws IllegalStateException Throws if manager is not initialized.
	 */
	void create(Rental rental);
	
	/**
	 * Updates existing instance with given instance in database.
	 * 
	 * @param rental Given Rental instance to update.
	 * @throws IllegalArgumentException Throws if given rental is null.
	 * @throws IllegalStateException Throws if manager is not initialized.
	 */
	void update(Rental rental);
	
	/**
	 * Removes given rental from database if exists.
	 * 
	 * @param rental Rental to remove from database.
	 * @throws IllegalArgumentException Throws if given rental is null.
	 * @throws IllegalStateException Throws if manager is not initialized.
	 */
	void remove(Rental rental);
	
	/**
	 * Load all existing rentals from database and returns them as list.
	 * 
	 * @return All existing rentals from database.
	 * @throws IllegalStateException Throws if manager is not initialized.
	 */
	List<Rental> findAll();
	
	/**
	 * Returns all existing rentals of machinery for given customer.
	 * 
	 * @param customer Customer, for which we want list of rented machinery.
	 * @return List of machines rented by customer.
	 * @throws IllegalArgumentException Throws if given customer is null.
	 * @throws IllegalStateException Throws if manager is not initialized.
	 */
	List<Rental> findByCustomer(Customer customer);
	
	/**
	 * Returns all existing rentals of given machine.
	 * 
	 * @param machine Machine, for which we want list of all rentals.
	 * @return List of all rentals of given machine.
	 * @throws IllegalArgumentException Throws if given machine is null.
	 * @throws IllegalStateException Throws if manager is not initialized.
	 */
	List<Rental> findByMachine(Machine machine);
	
	/**
	 * Returns list of rentals in given interval.
	 * 
	 * @param start Start date (dateOfRent) and time from which we want return rentals.
	 * @param end End date (dateOfRent) and time to which we want return rentals.
	 * @throws IllegalArgumentException Throws if given start date is null.
	 * @throws IllegalArgumentException Throws if given end date is null.
	 * @throws IllegalStateException Throws if manager is not initialized.
	 * @return List of rentals in given interval.
	 */
	List<Rental> findByIntervalOfRent(Date startDate, Date endDate);
}
